package com.his.dictitem.controller;

import com.his.config.annotation.CurrentUser;
import com.his.dictitem.entity.DictItemCharge;
import com.his.dictitem.service.DictItemChargeService;
import com.his.dictitem.vo.DictItemChargeVo;
import com.his.login.entity.DictEmployee;
import com.xiao.common.controller.ResultBaseController;
import com.xiao.common.util.BeanUtil;
import com.xiao.common.util.ResultUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * 项目价格维护控制类
 * @Author tansonglin
 * @Date 2020/3/14
 */
@RestController
@RequestMapping(value="/api/dict_item_charge")
public class DictItemChargeController extends ResultBaseController {
    private  final Logger logger = (Logger) LoggerFactory.getLogger(this.getClass());

    @Autowired
    private DictItemChargeService dictItemChargeService;

    /**
     * 插入价格
     */
    @PostMapping(value="/insert.do")
    public ResultUtil insertItemCharge(@CurrentUser DictEmployee dictEmployee,@RequestBody DictItemChargeVo dictItemChargeVo){
        try{
            dictItemChargeService.insert(dictEmployee,dictItemChargeVo);
            return this.success("成功",null);
        }catch(Exception e){
            e.printStackTrace();
            logger.error(e.getMessage());
            return this.fail(e.getMessage(),null);
        }
    }
}
